package com.br.apurn.model.service;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.List;


import com.br.apurn.model.dao.DAOException;
import com.br.apurn.model.dao.UserDAOImpl;
import com.br.apurn.model.dao.UserDAO;
import com.br.apurn.model.Usuario;

public class UserServiceImpl implements UserService{
	
	private UserDAOImpl daoUsers;
	private Statement st;
	
	public UserServiceImpl(){
		this.daoUsers = new UserDAOImpl();
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<Usuario> listusers() {
		try {
			return daoUsers.findAll("User");
		} catch (DAOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}

	@Override
	public void addUser(String name, String password, Integer id_) {
		Usuario user = new Usuario(id_, password, name);
		daoUsers.addEntity(user);
		
	}

}
